<?php
ob_start();
// PHPUnit
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Framework/IncompleteTestError.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/Runner/Version.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';

// Match ZF coding standard
error_reporting( E_ALL | E_STRICT );

// define dirs
//$madoquaRootDir     = dirname(__FILE__) . '/../..';
define ('MADOQUA_ROOT', dirname(__FILE__) . '/../..');
define ('MADOQUA_APP_DIR', MADOQUA_ROOT . DIRECTORY_SEPARATOR . 'madoqua_private/application');
define ('MADOQUA_LIB_DIR', MADOQUA_ROOT . DIRECTORY_SEPARATOR . 'madoqua_private/library');
define ('MADOQUA_TESTS_DIR', MADOQUA_ROOT . DIRECTORY_SEPARATOR . 'madoqua_private/tests');


// exclude tests & ZF from code coverage
PHPUnit_Util_Filter::addDirectoryToFilter(MADOQUA_LIB_DIR . DIRECTORY_SEPARATOR . 'HtmlPurifier');
PHPUnit_Util_Filter::addDirectoryToFilter(MADOQUA_APP_DIR);
PHPUnit_Util_Filter::addDirectoryToFilter(MADOQUA_LIB_DIR . DIRECTORY_SEPARATOR . 'Zend');


// include path
set_include_path(
    MADOQUA_LIB_DIR . PATH_SEPARATOR .
    MADOQUA_TESTS_DIR   . PATH_SEPARATOR .
    get_include_path()
);

// Help loading classes
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

// Always run metrics for library and app dir
PHPUnit_Util_Filter::addDirectoryToWhitelist(MADOQUA_LIB_DIR . DIRECTORY_SEPARATOR . 'Madoqua');

// Some needed globals
$_SERVER['HTTP_HOST'] = "foo.bar.com";

//unset($madoquaRootDir);